package come.niit.controllor;


import com.alibaba.fastjson.JSONObject;
import come.niit.daoimpl.Student4DaoImpl;
import come.niit.vo.Show_Data4;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/students")
public class Student4Servlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Student4DaoImpl empDao = new Student4DaoImpl();
        Show_Data4 data = empDao.getNums();
        String jsondata = JSONObject.toJSONString(data);
        resp.setCharacterEncoding("utf-8");
        resp.getWriter().write(jsondata);
    }
}
